<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Edit Room</title>
<script type="text/javascript">
 	  function kt(){  
         	var   roomnameKT =  document.getElementById("roomname1").value;
       	        if(roomnameKT==""){
       	        	alert(" Please enter correct room name!");
                	return false;
                }

    	    var  floor1 = document.getElementById("floor1").value;
    	        if(isNaN(floor1) ||floor1<=0||s>1000){
    	        	alert(" Please enter correct floor!");
             	return false;
             }   
    	    var roomNumber1 = document.getElementById("roomNumber1").value;
    	        if(isNaN(roomNumber1) ||roomNumber1<=0||roomNumber1>100000){
    	        	alert(" Please enter correct room number!");
             	return false;
             } 
    	 	 var building1 = document.getElementById("building1").value;
 		        if(building1=="" ||building1<=0){
 		        	alert(" Please enter correct building!");
     	     	return false;
     	     }   
 		  	 var status1 = document.getElementById("status1").value;
		        if(status1=="Select"||status1==""){
		        	alert(" Please enter select status!");
  	  		   	return false;
  	 	    }   
                return true;
            }	  
        </script>

</head>

<body>
<table id="customers">
		<tr class="even">
			<th>Roomname</th>
			<th>Floor</th>
			<th>RoomNumber</th>
			<th>Building</th>
			<th>Status</th>
		</tr>
		
		<s:iterator value="room" status="roomStatus" id="room">
			<tr class="<s:if test="roomStatus == true ">odd</s:if> <s:else>even</s:else>">
			<td><s:property value="roomname" /></td>
			<td><s:property value="floor" /></td>
			<td><s:property value="roomNumber" /></td>
			<td><s:property value="building" /></td>
			<td><s:property value="status" /></td>
			</s:iterator>		
	</table>
<div id="functionLabel">
		<p>Edit Room</p>
</div>
	
<div id="insForm">
	<s:actionerror />
	<s:form action="saveOrUpdateRoom" method="post" validate="true" onSubmit="return confirmAction()">
	<s:push value="room">
		<s:hidden  name="id"/>
		<s:textfield name="roomname" key="New room name" size="20" id="roomname1" />
		<s:textfield name="floor" key="New Floor" size="20" id="floor1"/>
		<s:textfield name="roomNumber" key="New room number" size="20" id="roomNumber1"/>
		<s:textfield name="building" key="New building" size="20" id="building1"/>
		<td><s:select name="status" list="{'true','false'}"
			headerKey="" headerValue="Select"
			label="Select a value" id="status1"/></td>
		<s:submit method="execute" cssClass="button" label="Edit room" align="center"/>
		</s:push>
	</s:form>
		</div>
</body>